//
// Created by v on 19-6-25.
//

#ifndef JKLIBS_CMCONFIGSIMPLE_H
#define JKLIBS_CMCONFIGSIMPLE_H

#include "config/cm_conf_ex.h"

class CMConfigSimple
{
  public:
    enum
    {
        CONF_ERROR_NOT_EXIST = -10000,
    };

    explicit CMConfigSimple(const char *filename);

    int writeBack();

    int getInt(const char *key);
    int getString(const char *key, std::string &result);
    int getDouble(const char *key, double &result);
    int getBool(const char *key, bool &result);

    int setString(const char *key, const std::string &value);

  private:
    std::string                        m_filename;
    std::map<std::string, std::string> m_list;
    bool                               m_valid;
};

#endif // JKLIBS_CMCONFIGSIMPLE_H
